package com.example.demo.concurrent.interrupt;

import lombok.extern.slf4j.Slf4j;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-06-28
 * Time: 10:41
 */
@Slf4j(topic = "c.InterruptTest2")
public class InterruptTest2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            while(true) {
                log.debug("test...");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }, "t1");
        t1.start();
        Thread.sleep(2000);
        t1.stop();
    }
}
